/***
 * @file Declaration.cpp
 *
 *  @Author: calle
 *  @date Mar 28, 2011
 *  
 *  @breif
 *  	
 */

#include "Declaration.h"
#include <Interfaces/IStmtVisitor.h>
#include "Ident.h"

Declaration::Declaration(ExpressionType type,Ident *ident,IExp *exp):
m_Type(type),
m_Ident(ident->clone()),
m_Exp(exp->clone())
{

}

Declaration::~Declaration() {

	delete m_Ident;
	m_Ident = NULL;

	delete m_Exp;
	m_Exp = NULL;
}


std::string Declaration::cmdString() const
{
	return "Declaration";
}

void Declaration::accept(IStmtVisitor *v) {
	v->VisitDeclaration(this);

}

Declaration* Declaration::clone() const {
	return (new Declaration(m_Type,m_Ident,m_Exp));
}

const ExpressionType Declaration::getType() const
{
	return m_Type;
}


void Declaration::setType(ExpressionType type)
{
	m_Type = type;
}

const Ident& Declaration::getIdent() const
{
	return *m_Ident;
}


void Declaration::setIdent(const Ident& ident)
{
	m_Ident = ident.clone();
}

const IExp& Declaration::getExp() const
{
	return *m_Exp;
}

void Declaration::setExp(const IExp& exp)
{
	m_Exp = exp.clone();
}
